buildscript {
    ext {
        kotlin_ver = "1.9.20"

        tornadofx_ver = "1.7.20" //"1.7.20" //"1.7.13"
    }

    repositories {
        mavenCentral()
    }
}

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version "$kotlin_ver"
}

apply plugin: 'idea'

compileJava.options.encoding = 'UTF-8'

tasks.withType(JavaExec) {
    jvmArgs = ['-Xmx2g']
}

repositories {
    mavenCentral()
}

dependencies {
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: "$kotlin_ver"

    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: "$kotlin_ver"

    implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+'
    implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.11'
    //implementation group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.6.4'

    implementation group: 'org.apache.derby', name: 'derby', version: '10.14.1.0'

    implementation "no.tornado:tornadofx:$tornadofx_ver"

    implementation group: 'com.sun.mail', name: 'javax.mail', version: '1.6.+'

    implementation group: 'com.lowagie', name: 'itext', version: '2.1.7'
    implementation group: 'com.lowagie', name: 'itext-rtf', version: '2.1.7'

    implementation group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.11'

    implementation group: 'net.sourceforge.jexcelapi', name: 'jxl', version: '2.6.12'

    implementation group: 'org.jsoup', name: 'jsoup', version: '1.11.2'

    implementation group: 'org.jasypt', name: 'jasypt', version: '1.9.2'

    implementation group: 'mysql', name: 'mysql-connector-java', version: '5.1.47'

    implementation group: 'org.firebirdsql.jdbc', name: 'jaybird', version: '2.2.15'

    implementation group: 'com.jcraft', name: 'jsch', version: '0.1.55'

    implementation group: 'org.dom4j', name: 'dom4j', version: '2.1.1'

    implementation group: 'org.swinglabs.swingx', name: 'swingx-all', version: '1.6.5-1'

   // compile group: 'org.apache.poi', name: 'poi', version: '4.1.2'
    implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.2'

    implementation group: 'com.oracle.database.jdbc', name: 'ojdbc6', version: '11.2.0.4'
    // implementation 'com.oracle.database.jdbc:ojdbc10:19.21.0.0'

    testImplementation group: 'junit', name: 'junit', version: '4.12'
    testImplementation 'org.testng:testng:7.1.0'
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
    kotlinOptions {
        languageVersion = "1.9"
    }
}

compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
    kotlinOptions {
        languageVersion = "1.8"
    }
}

jar {

    duplicatesStrategy = DuplicatesStrategy.EXCLUDE

    manifest {
        attributes 'Main-Class': 'ru.barabo.observer.main.ObserverKt'
    }

    from configurations.runtimeClasspath.collect  {
        it.isDirectory() ? it : zipTree(it).matching {
            exclude {
                it.name.contains('.DSA') ||
                it.name.contains('.SF') ||
                it.name.contains('.RSA') ||
                it.name.contains('MasterKeyTest')
            }
        }
    }
}
